﻿CREATE proc [dbo].[proc_CheckInOut_GetVisitList]
(
	@CustomerId nvarchar(50)
)
as
	select 
		id,
		IsNull(CompanyId,0) As CompanyId,
		CustomerId,
		(select CustomerName from Customer where Customer.CustomerId=CheckInOut.CustomerId) as Customer,
		ContactPerson,
		ContactTel, 
		Address,
		MainProjectId,
		(Select Title From OProject Where Id=CheckInOut.MainProjectId) As MainProject,
		Content,
		Aim,
		Accompany,
		UserName,
		IsNull(CheckInTime,'') As CheckInTime,
		CheckOutTime
	from CheckInOut where CustomerId=@CustomerId

